package pl.edu.uj.ii.battleships.models;

import pl.edu.uj.ii.battleships.R;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class BoardItem {
	private Bitmap bitmap;
	private Status status = Status.EMPTY;
	private Context context;
	
	
	public enum Status{
		EMPTY,
		HIT,
		DESTROYED,
		SHIP,
		MISS
	}

	public BoardItem(Context context) {
		this.context = context;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
		if(status.equals(Status.EMPTY))
			this.bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.empty);
		else if(status.equals(Status.SHIP)) {
			this.bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.ship);
		} else if(status.equals(Status.HIT)) {
			this.bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.hit);
		} else if(status.equals(Status.DESTROYED)) {
			this.bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.destroyed);
		}
	}

	public Bitmap getBitmap() {
		return bitmap;
	}

	public void setBitmap(Bitmap bitmap) {
		this.bitmap = bitmap;
	}
}
